package com.jy.modules.cims.component.common.service;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jy.modules.cims.data.common.dao.TCMmTaskLogDao;
import com.jy.modules.cims.data.common.dto.TCMmTaskLogDTO;
import com.jy.platform.core.common.BaseDTO;


/**
 * @classname: TCMmTaskLogService
 * @description: 定义  任务日志 实现类
 * @author:  dell
 */
@Service("com.jy.modules.cims.component.common.service.TCMmTaskLogService")
public class TCMmTaskLogService implements Serializable {

    private static final long serialVersionUID = 1L;
    
	@Autowired
	private TCMmTaskLogDao dao;

	/**
     * @author dell
     * @description: 分页查询 任务日志列表
     * @date 2015-11-02 16:32:36
     * @param searchParams 条件
     * @return
     * @throws
     */ 
	public List<TCMmTaskLogDTO> searchTCMmTaskLogByPaging(Map<String,Object> searchParams) throws Exception {
		List<TCMmTaskLogDTO> dataList =  dao.searchTCMmTaskLogByPaging(searchParams);
		return dataList;
	}
	/**
	 * 
	 * @Title searchTCMmTaskLogTotalByPaging
	 * @Description TODO
	 * @param searchParams
	 * @return
	 * @throws Exception 
	 * List<TCMmTaskLogDTO> 
	 * @date 2016-11-14-上午9:45:37
	 * @update 
	 * @throws
	 */
	public List<TCMmTaskLogDTO> searchTCMmTaskLogTotalByPaging(Map<String,Object> searchParams) throws Exception {
		List<TCMmTaskLogDTO> dataList =  dao.searchTCMmTaskLogTotalByPaging(searchParams);
		return dataList;
	}
	/**
     * @author dell
     * @description: 按条件查询任务日志列表
     * @date 2015-11-02 16:32:36
     * @param searchParams 条件
     * @return
     * @throws
     */
	public List<TCMmTaskLogDTO> searchTCMmTaskLog(Map<String,Object> searchParams) throws Exception {
	    List<TCMmTaskLogDTO> dataList = dao.searchTCMmTaskLog(searchParams);
        return dataList;
    }
	/**
     * @author dell
     * @description: 查询任务日志对象
     * @date 2015-11-02 16:32:36
     * @param id
     * @return
     * @throws
     */ 
	public TCMmTaskLogDTO queryTCMmTaskLogByPrimaryKey(String id) throws Exception {
		
		TCMmTaskLogDTO dto = dao.findTCMmTaskLogByPrimaryKey(id);
		
		if(dto == null) dto = new TCMmTaskLogDTO();
		
		return dto;
		
	}

	/**
     * @title: insertTCMmTaskLog
     * @author dell
     * @description: 新增 任务日志对象
     * @date 2015-11-02 16:32:36
     * @param dto
     * @return
     * @throws
     */
	@SuppressWarnings("all")
	public Long insertTCMmTaskLog(TCMmTaskLogDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		int count = dao.insertTCMmTaskLog(paramMap);
		
		TCMmTaskLogDTO resultDto = (TCMmTaskLogDTO) paramMap.get("dto");
		Long keyId = resultDto.getId();
		return keyId;
	}
	/**
     * @title: updateTCMmTaskLog
     * @author dell
     * @description: 修改 任务日志对象
     * @date 2015-11-02 16:32:36
     * @param paramMap
     * @return
     * @throws
     */
	public void updateTCMmTaskLog(TCMmTaskLogDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		dao.updateTCMmTaskLog(paramMap);
	}
	/**
     * @title: deleteTCMmTaskLogByPrimaryKey
     * @author dell
     * @description: 删除 任务日志,按主键
     * @date 2015-11-02 16:32:36
     * @param paramMap
     * @throws
     */ 
	public void deleteTCMmTaskLogByID(BaseDTO baseDto,String ids) throws Exception {
		if(StringUtils.isEmpty(ids)) throw new Exception("删除失败！传入的参数主键为null");
		
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", baseDto);
		paramMap.put("ids", ids);
		dao.deleteTCMmTaskLogByID(paramMap);
	}

}

